const MIN_SCROLL_TOP = 700;

onScroll = function() {
    var up = document.getElementById('up');
	var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    if (scrollTop > MIN_SCROLL_TOP) {
        up.setAttribute('class','shown');
    } else {
	    up.setAttribute('class','hidden');
	}
}

upScroll = function() {
    window.scroll(0,0);
}

document.write('<div id="up" class="hidden" onclick="upScroll()"><div class="up_img"></div><div class="up_text">&#1042;&#1074;&#1077;&#1088;&#1093;</div></div>');

if("addEventListener" in window) { 
   window.addEventListener('scroll', onScroll, false); 
} else if ("attachEvent" in window) { 
   window.attachEvent( 'onscroll', onScroll); 
} 